// 消息类型
const MessageType = {
    // MESSAGE: 'message', // 普通
    SUCCESS: 'success', // 成功
    ERROR: 'error', // 错误
    // WARNING: 'warning' // 警告
}

// 状态icon图标
const MessageIcons = {
    // MESSAGE: 'el-icon-info',
    SUCCESS: 'glyphicon glyphicon-ok-circle',
    ERROR: 'glyphicon glyphicon-exclamation-sign',
    // WARNING: 'el-icon-warning'
}

// 状态对应的主色
const MessageTypeColor = {
    // MESSAGE: '#909399',
    SUCCESS: '#67c23a',
    ERROR: '#f56c6c',
    // WARNING: '#e6a23c'
}

let message = {
    showText:function (type,message){
        // 创建一个DOM元素
        let ele = document.createElement("div")
        ele.innerHTML = message

        $(ele).addClass("toastBox")
        let savg
        if (type === "success"){
            savg = $("<svg t=\"1672399383937\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2962\" width=\"16\" height=\"16\"><path d=\"M511.998465 65.290005c-246.722194 0-446.708971 200.001103-446.708971 446.708971 0 246.708891 199.986777 446.709995 446.708971 446.709995 246.708891 0 446.711018-200.001103 446.711018-446.709995C958.709483 265.291109 758.707356 65.290005 511.998465 65.290005L511.998465 65.290005zM756.308727 405.884171 465.103412 697.081299c-6.804986 6.819313-17.856693 6.819313-24.662703 0L267.69025 524.33084c-6.804986-6.804986-6.804986-17.856693 0-24.668843l54.29765-54.290487c6.804986-6.812149 17.856693-6.812149 24.662703 0l106.122993 106.107643 224.574778-224.561475c6.804986-6.812149 17.857716-6.812149 24.663726 0l54.29765 54.290487C763.128039 388.020314 763.128039 399.072021 756.308727 405.884171L756.308727 405.884171 756.308727 405.884171zM756.308727 405.884171\" fill=\"#89C27E\" p-id=\"2963\"></path></svg>&nbsp;&nbsp;&nbsp;")
            $(savg).addClass("dis")
            $(ele).addClass("success")
        }else {
            savg = $("<svg t=\"1672401177850\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"3980\" width=\"16\" height=\"16\"><path d=\"M511.999488 65.290005C265.29162 65.290005 65.290517 265.291109 65.290517 511.998977c0 246.708891 200.001103 446.709995 446.708971 446.709995S958.70846 758.707868 958.70846 511.998977C958.70846 265.291109 758.707356 65.290005 511.999488 65.290005L511.999488 65.290005zM716.82855 637.854383c6.803963 6.819313 6.803963 17.856693 0 24.676006l-54.298673 54.29765c-6.819313 6.804986-17.85567 6.820336-24.676006 0L511.999488 590.973656 386.144082 716.828039c-6.819313 6.804986-17.871019 6.804986-24.676006 0l-54.29765-54.29765c-6.804986-6.804986-6.804986-17.856693 0-24.676006l125.869732-125.855406L307.170426 386.144594c-6.804986-6.819313-6.804986-17.871019 0-24.676006l54.29765-54.298673c6.820336-6.803963 17.856693-6.803963 24.676006 0l125.855406 125.870756 125.854383-125.870756c6.820336-6.803963 17.856693-6.803963 24.676006 0l54.298673 54.298673c6.803963 6.804986 6.803963 17.856693 0 24.676006L590.973144 511.998977 716.82855 637.854383 716.82855 637.854383zM716.82855 637.854383\" fill=\"#FF696A\" p-id=\"3981\"></path></svg>")
            $(savg).addClass("dis")
            $(ele).addClass("error")
        }

        $(ele).prepend(savg).hide().appendTo("body").slideDown(300)
        window.setTimeout(function (){
            $(ele).show().slideUp(300,function (){
                $(ele).remove();
            })
        },2000)
    }
}